﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Xna.Framework.Media;
using System.Windows.Threading;
using Microsoft.Xna.Framework;

namespace JsonTest1.Media
{
    public class AudioPlayerEngine
    {

        public AudioPlayerEngine()
        {



        }

        public void start(Uri audioUri)
        {
            try
            {
               


                //创建音频对象

                Song song = Song.FromUri("Music", audioUri);

                MediaPlayer.Volume = 0.5F;


                //设置为循环播放

                MediaPlayer.IsRepeating = true;

                //启动播放

                MediaPlayer.Play(song);

            }

            catch (System.Exception ex)
            {

                //创建音频对象失败，uri错误时

            }


        }


        public void Stop()
        {
            MediaPlayer.Stop();
        }

        public void Pause()
        {
            MediaPlayer.Pause();
        }

        public void Resume()
        {
            MediaPlayer.Resume();
        }
    }
}
